﻿@using LanDBom.Models
@using LanDBom.Resources
@{
    ViewBag.Title = "Profit";
    Layout = "~/Views/Shared/_Genertals.cshtml";
}
<from>
    <fieldset class="boun">
        <legend></legend>
        <div class="row bian">
            <label class="col-sm-3 breadcrumb-item ">步骤六：销售员确认</label>
            <ul id="lisul" class="row col-sm-4">
                <li class="lisu"></li>&rArr;
                <li class="lisu"></li>&rArr;
                <li class="lisu"></li>&rArr;
                <li class="lisu"></li>&rArr;
                <li class="lisu"></li>&rArr;
                <li class="lisu">6</li>&rArr;
                <li class="lisu"></li>&rArr;
                <li class="lisu"></li>
            </ul>
            <div class="anzhu col-sm-5" style="text-align:right">

                <div class="col-2"><button class="btn-outline" id="tijiao" style="margin-left:25%">@Resource.String444</button></div>
                <div class="col-2"><button class="btn-outline" id="tiaoguo" style="margin-left:3%">驳回</button></div>
                <div class="col-2"><button class="btn-outline" onclick="history.go(-1)" style="margin-left:3%">返回</button></div>
            </div>
        </div>
    </fieldset>
</from>
<div class="Zhuyags">
    <div class="col-2 nav-item" id="divjibeng" style="background-color:#fff">@Resource.String48</div>
    <div class="col-2 nav-item" id="divbeizhu">@Resource.String49</div>
    <div class="col-2 nav-item" id="divtuzhi">@Resource.String50</div>
    <div class="col-2 nav-item" id="hejiaxx">核价详细</div>
    <div class="col-2 nav-item" id="divweituo" style="display:none">@Resource.String51</div>
</div>
<div>
    <div id="div1">
        <form class="biao1" action="/">
            <fieldset class="boun">
                <legend class="len1 ">@Resource.String428</legend>
                <table class="table" style="width:80%" align="left">
                    @foreach (LanDBom.Models.Applications item in Model)
                    {
                        <tr>
                            <td style="width:50%;">
                                @Html.Label(Resource.String429): @item.App_Kehu
                            </td>
                            <td style="width:50%;">
                                @Html.Label(Resource.String430):<label id="shenDan">@item.AP_bian</label>
                            </td>
                        </tr>
                        <tr>
                            <td>@Html.Label(Resource.String431): @item.App_qishi</td>
                            <td>@Html.Label(Resource.String432):@item.App_JTime</td>
                        </tr>
                        <tr>
                            <td>@Html.Label(Resource.String433): @item.APP_name</td>
                            <td>@Html.Label(Resource.String434): @item.App_lei</td>
                        </tr>
                        <tr>
                            <td>@Html.Label(Resource.String435): @item.APP_Zhong</td>
                            <td style="width:50%;">@Html.Label(Resource.String436): <lable id="leb"></lable></td>
                        </tr>
                        <tr>
                            <td>@Html.Label(Resource.String437):@item.App_dizhi</td>
                            <td>@Html.Label(Resource.String438): @item.App_sho</td>
                        </tr>
                        <tr style="display:none"><td id="jc_zhu">@(Session["JC_zhuang"])</td></tr>
                    }
                </table>

            </fieldset>
        </form>
    </div>
    @*项目备注*@
    <div id="div2" style="display:none">
        <div class="">
            <div id="bigbox1">
                <fieldset class="boun" id="boun" style="height:150px">
                    <legend class="len">@Resource.String558</legend>
                    <div id="RZ_gwzr" class="beizhugun">
                    </div>
                </fieldset>
            </div>
            <div>
                <fieldset class="boun" id="boun2">
                    <legend class="len">@Resource.String560</legend>
                    <div class="row">
                        <div class="col-2">@Resource.String563</div>
                        <div class="col-8"><textarea id="RZ_xznr" class="col-10" style="height:100px"></textarea></div>
                    </div>
                    <div style="text-align:right">
                        <button id="RZ_tjrz" class="col-2">@Resource.String564</button>
                    </div>
                </fieldset>
            </div>
        </div>
    </div>
    @*图纸备注*@
    <div id="div3" style="display:none">
        <div class="">
            <fieldset class="boun">
                <legend class="len">@Resource.String84</legend>
                <table class="table tab">
                    <thead style="text-align:center;">
                        <tr style="background-color: #6e95bc">
                            <td>@Resource.String85</td>
                            <td>@Resource.String86</td>
                            <td>@Resource.String1297</td>
                            <td>@Resource.String87</td>
                            <td>@Resource.String88</td>
                            <td>@Resource.String1298</td>
                            <td>@Resource.String89</td>
                        </tr>
                    </thead>
                    <tbody id="div3__tb">
                    </tbody>
                    <tfoot>
                        <tr>
                            <td>@Resource.String1299</td>
                            <td colspan="4"></td>
                            <td id="SJ_ZYS"></td>
                            <td></td>
                        </tr>
                    </tfoot>
                </table>
            </fieldset>
        </div>
    </div>
    <div id="divsw4" style="display:none">
        <fieldset class="boun">
            <legend class="len">报价详细</legend>
            <table class="table tab">
                <thead style="text-align:center;">
                    <tr style="background-color: #6e95bc">
                        <td>物料名</td>
                        <td>供应商</td>
                        <td>阶梯</td>
                        <td>供应商回价</td>
                        <td>理论价格</td>
                    </tr>
                </thead>
                <tbody id="div4__tb">
                </tbody>
            </table>
        </fieldset>
    </div>
</div>
<div>
    <input type="button" id="tianjiask" value="添加利润" style="margin:5px;" class="btn-sm btn-group" />
    <table class="table table-sm gun tab">
        <thead class="" id="BoCt">
            <tr style="text-align-last: left; background-color: #6e95bc">
                <th style="width:50px;" scope="col">@Resource.String1000</th>
                <th scope="col">@Resource.String1001</th>
                <th scope="col">@Resource.String1002</th>
                <th scope="col">@Resource.String1003</th>
                <th scope="col">@Resource.String1004</th>
                <th scope="col">@Resource.String1005</th>
                <th scope="col">@Resource.String1006</th>
                <th scope="col">物料规格</th>
                <th scope="col">物料类型</th>
                <th scope="col">阶梯 ：供应商报价</th>
                <th scope="col">@Resource.String1008</th>
            </tr>
        </thead>
        <tbody data-spy="scroll" id="BoTa" class="thead-light" style="height:300px;">
            @foreach (var item in ViewBag.F_bom as List<BOMini>)
            {
                <tr style="text-align-last:left;">
                    <td style="width:50px;"></td>
                    <td id="CG_INFSQD" style="display:none">@item.BOM2_id</td>
                    <td id="chen"> @item.BOM2_chen</td>
                    <td id="duan"> @item.BOM2_duan</td>
                    <td id="liao"> @item.BOM2_liao</td>
                    <td id="wuliao"> @item.BOM2_wuLiu</td>
                    <td> @item.BOM2_Nian</td>
                    <td> @item.BOM2_Yong</td>
                    <td> @item.BOM2_Guige</td>
                    <td> @item.BOM2_Lei</td>
                    @if (item.BOM2_CB == null || item.BOM2_CB == "")
                    {
                        <td>0</td>
                    }
                    else
                    {
                        var shund = "";
                        for (int i = 0; i < item.BOM2_CB.Split(',').Length; i++)
                        {
                            var jinn = item.BOM2_CB.Split(',')[i].Split(':');
                            if (jinn.Length < 2)
                            {
                                continue;
                            }
                            shund = jinn[1] + "：" + jinn[2] + "\t";
                        }
                        <td>@shund</td>
                    }
                    <td style="display:none">@item.BOM2_Sone</td>
                    <td id="DanJe_sel">@item.BOM2_ST</td>
                </tr>
            }
        </tbody>
    </table>
</div>
<div id="WT_dh_mb" style="display:none;position:fixed;background-color:white;top:200px;width:360px;left:300px;z-index:1000;border:1px black solid;">
    <div id="WJ_ID" style="display:none"></div>
    <table>
        <tr>
            <td>驳回节点：</td>
            <td>
                <select id="BHJD">
                    <option value="1">上一步</option>
                    <option value="2">报价发起</option>
                </select>
            </td>
        </tr>
        <tr>
            <td>审核人：</td>
            <td id="WT_dhr"></td>
        </tr>
        <tr>
            <td>驳回理由</td>
            <td><textarea id="WT_dhly"></textarea></td>
        </tr>
        <tr>
            <td><button id="WT_qdbh">确定</button> </td>
            <td><button id="WT_qxbh">取消</button></td>
        </tr>
    </table>
</div>
@*批量添加利润*@
<div id="baijai" style="display:none;position: fixed; background-color: #ebebeb; top: 33%; width: 60%; left: 20%; z-index: 1000; border: 1px solid black;">
    <div style=" width: 100%; background-color: #bacee9;" class="Tuodong"><span>点击这里拖动窗体</span></div>
    <div style="text-align: right; line-height: 2; padding-right: 22px; background: #b1cae0;"><i class="bi bi-x-circle Tuix"></i></div>
    <div style="display: flex; justify-content: flex-end; flex-wrap: nowrap;">
        <p class="col-6" style="text-align:left"><span>批量输入利润：</span><input type="text" value="0" id="PLshu" /></p>
        <p class="col-6" style="text-align-last:right"><button id="Tijiaos">确定</button><button class="Tuix">退出</button></p>
    </div>
    <div>
        <table class="table tab">
            <thead>
                <tr style="text-align:center">
                    <th style="width:50px;"><input type="checkbox" id="Quanxuan" /></th>
                    <th>物料名</th>
                    <th style="width:37%">供应商</th>
                    <th>阶梯</th>
                    <th>供应商报价</th>
                    <th>二级分类</th>
                    <th>填写利润</th>
                    <th>报价价格</th>
                </tr>
            </thead>
            <tbody class="CNSHU" style=" height: 300px;">
            </tbody>
        </table>
    </div>
</div>
@section scripts{
    <script>
        //点击切换基础信息，备注信息，图纸沟通
        $(function () {
            $("#divjibeng").click(function (e) {
                $("#div1").css({ "display": "block" });
                $("#div2").css({ "display": "none" });
                $("#div3").css({ "display": "none" });
                $("#divsw4").css({ "display": "none" });
                $(this).css({ "background-color": "#fff" })
                $(this).siblings().css({ "background-color": "#ededed" })
            })
            $("#divbeizhu").click(function (e) {
                $("#div2").css({ "display": "block" });
                $("#div1").css({ "display": "none" });
                $("#div3").css({ "display": "none" });
                $("#divsw4").css({ "display": "none" });
                $(this).css({ "background-color": "#fff" })
                $(this).siblings().css({ "background-color": "#ededed" })
            })
            $("#divtuzhi").click(function (e) {
                $("#div3").css({ "display": "block" });
                $("#div1").css({ "display": "none" });
                $("#div2").css({ "display": "none" });
                $("#divsw4").css({ "display": "none" });
                $(this).css({ "background-color": "#fff" })
                $(this).siblings().css({ "background-color": "#ededed" })
            })
            $("#hejiaxx").click(function () {
                $("#div3").css({ "display": "none" });
                $("#div1").css({ "display": "none" });
                $("#div2").css({ "display": "none" });
                $("#divsw4").css({ "display": "block" });
                $(this).css({ "background-color": "#fff" })
                $(this).siblings().css({ "background-color": "#ededed" })
            })
        })
         $(function () {
            gettbz()//搜索备注信息
            //获取备注信息
             gettinf()

             function gettinf() {
                 var kan = $("#shenDan").text();
                 $.ajax({
                     url: "/Custom/Profit",
                     type: "POST",
                     data: { "liyou": kan, "names": kan, "state": 2 },
                     success: function (sjik) {
                         $("#div4__tb tr").remove();
                         $.each(sjik, function (i, item) {
                             var $tr =
                                 $(`
                                    <tr>
                                        <td>${item.Inf_wu}</td>
                                        <td>${item.Inf_gong}</td>
                                        <td>${item.Inf_JT}</td>
                                        <td>${item.Inf_huiP}</td>
                                        <td>${item.BOM2_mioa}</td>
                                    </tr>
                                `);
                             $("#div4__tb").append($tr);
                         })
                     },
                     error: function () {
                         alert("erroer");
                     },
                 })
             }

            function gettbz() {
                var kan = $("#shenDan").text();
                $.ajax({
                    url: "/Application/Application",
                    type: "POST",
                    data: { "App_ban": kan, "state": 4 },
                    success: function (sjik) {
                        $("#RZ_gwzr div").remove();
                        $.each(sjik, function (i, item) {
                            var $tr = $(`  <div>
                                    <div>
                                        <span style="color:red">${item.B_BR}</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span>${item.B_Date}</span>
                                    </div>
                                    <div style="border-bottom:1px solid #808080">
                                        ${item.B_bei}
                                    </div>
                                </div>`);
                            $("#RZ_gwzr").append($tr);
                        })
                    },
                    error: function () {
                        alert("erroer");
                    },
                })

                var len = $('#BoTa tr').length;
                for (var i = 0; i < len; i++) {
                    $('#BoTa tr:eq(' + i + ') td:nth-child(1)').text(i + 1);
                }
            }
             //获取图纸信息
            Load_design_table()
            //获取图纸信息
            function Load_design_table() {
                $.ajax({
                    url: '/Application/Application',
                    type: 'POST',
                    data: { "state": 3, "App_ban": $('#shenDan').text()},
                    success: function (path) {
                        createFJ(path)
                    },
                    error: function () {
                        alert("系统错误!");
                    }
                })
            }
            function createFJ(fgggh) {
                $("#logfuj tr").remove();
                $("#div3__tb tr").remove();
                var ind1 = 1
                var ind2 = 1
                var temp=0
                $.each(fgggh, function (i, item) {
                    var x = item.De_dizhi
                    if (item.DE_lei == "图纸") {
                        var $tr = (`
                        <tr class="log_tr">
                            <td style="display:none">${item.DE_id}</td>
                            <td>${ind1}</td>
                            <td>${item.DE_TZname}</td>
                            <td>${item.bom_id}</td>
                            <td>${item.De_shijian}</td>
                            <td>${item.De_ren}</td>
                            <td>
                                <input type="number" readonly="readonly" value="${item.DE_Slong}" style="width:60px;height:30px"/>
                            </td>
                            <td><a href="#" id="log_SC">删除</a>/<a href="/Contracts/Download_file?path=${x}" id="log_SZ">@Resource.String582</a></td>
                        </tr>`);
                        $("#div3__tb").append($tr);
                        ind1++
                        temp += item.DE_Slong*1
                    }
                    else {
                        var $tr = (`
                        <tr class="log_tr">
                            <td style="display:none">${item.DE_id}</td>
                            <td>${ind2}</td>
                            <td>${item.De_dizhi}</td>
                            <td>${item.De_shijian}</td>
                            <td>${item.De_ren}</td>
                            <td><a href="/Contracts/Download_file?path=${x}" id="log_SZ">@Resource.String582</a></td>
                        </tr>`);
                        $("#logfuj").append($tr);
                        ind2++
                    }
                })
                $("#SJ_ZYS").text(temp)
            }
         })
        $(function () {
            $(document).on("click", "#tiaoguo", function () {
                var Name = $("#Login_N").text()
                $("#WT_dhr").text(Name)
                $("#WT_dh_mb").show();
            })
            $(document).on("click", "#WT_qxbh", function () {
                $("#WT_dh_mb").hide();
                $("#WT_dhly").text("");
            })
            $(document).on("click", "#Quanxuan", function () {
                console.log($(this).ckecked)
                if ($(this).prop('checked')) {
                    $(".Dinaji").prop("checked", true)
                } else {
                    $(".Dinaji").prop("checked", false)
                }

            })
            //驳回对应
            function Rejected_plan() {
                var Binas = $("#shenDan").text()
                var Name = $("#Login_N").text()
                var MMK = $("#WT_dhly").val()
                if (MMK != "") {
                    $.ajax({
                        url: '/Custom/Profit',
                        type: 'POST',
                        data: { "state": 1, "names": Binas, "Namesed": Name, "liyou": MMK },
                        success: function (data) {
                            //返回是否是他审批
                            alert(data)
                            if (data == "已驳回") {
                                var mbr = $("#FQFQi").text()
                                var name = $("#Login_N").text()
                                var BOJL = [];
                                BOJL.push({
                                    Fr_fl: "物料询价",//待处理模块
                                    De_tiji: "申请单驳回",//待处理内容
                                    Cl_juli: mbr,//接收人
                                    Nd_jiage: name,//发起人
                                    Fr_zhuang: "待处理"//装态
                                })
                                console.log("共" + BOJL.length + "数据");
                                console.log(BOJL);
                                $.ajax({
                                    url: "/Contracts/Addfr",
                                    type: 'POST',
                                    data: JSON.stringify(BOJL),
                                    contentType: "application/json;charset=utf-8",
                                    dataType: "json",
                                    success: function (text) {
                                        console.log(text)
                                        if (text != "新增:0条") {
                                            alert(text)
                                            window.location.href = "/Custom/General?SHun=6"
                                        }
                                    },
                                    error: function (text) {
                                        alert("系统错误" + text);
                                    }
                                })

                            }
                        },
                        error: function () {
                            alert("系统错误!");
                        }
                    })
                } else {
                    alert("请输入理由！")
                }

            }
            function Rejected_plan12() {
                var de_id = $("#shenDan").text()
                var bhly = $("#WT_dhly").val()
                var shr = $("#WT_dhr").text()
                if (bhly == "") {
                    alert("请输入驳回理由")
                }
                else {
                    var BZJG = [];
                    BZJG.push({
                        AP_bian: de_id,
                        APP_shr: shr,
                        APP_liy: bhly,
                        App_bu: "1",
                        App_zhuang: "驳回"
                    })
                    console.log("共" + BZJG.length + "数据");
                    console.log(BZJG);
                    $.ajax({
                        url: "/Procure/Modify_INF_zhuang4",
                        type: 'POST',
                        data: JSON.stringify(BZJG),
                        contentType: "application/json;charset=utf-8",
                        dataType: "json",
                        success: function (text) {
                            var regex = /\-?\d+(\.\d+)?/g;
                            var matches = text.match(regex);
                            if (matches == null) {
                                alert("驳回失败！")
                            } else {
                                var mbr = $("#FQFQi").text()
                                var name = $("#Login_N").text()
                                var BZJG = [];
                                BZJG.push({
                                    Fr_fl: "物料询价",//待处理模块
                                    De_tiji: "物料询价被驳回",//待处理内容
                                    Cl_juli: mbr,//接收人
                                    Nd_jiage: name,//发起人
                                    Fr_zhuang: "待处理"//装态
                                })
                                console.log("共" + BZJG.length + "数据");
                                console.log(BZJG);
                                $.ajax({
                                    url: "/Contracts/Addfr",
                                    type: 'POST',
                                    data: JSON.stringify(BZJG),
                                    contentType: "application/json;charset=utf-8",
                                    dataType: "json",
                                    success: function (text) {
                                        var regex = /\-?\d+(\.\d+)?/g;
                                        var matches = text.match(regex);
                                        if (matches == null) {
                                            alert("已驳回至对应人")
                                        } else {
                                            alert("已驳回至对应人")
                                            location.reload(true)
                                            location.href = "/Material/JJInksm?SHun=3"
                                        }

                                    },
                                    error: function (text) {
                                        alert("系统错误" + text);
                                    }
                                })
                            }
                        },
                        error: function (text) {
                            alert("系统错误" + text);
                        }
                    })
                }
            }
            //确定驳回
            $(document).on("click", "#WT_qdbh", function () {
                var shunf = $("#BHJD").val()
                if (shunf == 1) {
                    Rejected_plan()
                } else {
                    Rejected_plan12()
                }

            })
            //添加利润
            $(document).on("click", "#tianjiask", function () {
                $("#baijai").show()
                $(".SHUa").each(function () {
                    var lirun = $(this).val()
                    var CB = $(this).parent().parent().children().eq(5).text()
                    var shhiji = lirun * CB / 100;
                    shhiji += CB * 1
                    $(this).parent().parent().children().eq(8).children().val(shhiji.toFixed(4))
                })
            })
            //退出
            $(".Tuix").click(function () {
                $("#baijai").hide()
            })
            //添加利润
            $(document).on("keyup", ".SHUa", function () {
                var lirun = $(this).val()
                var CB = $(this).parent().parent().children().eq(5).text()
                var shhiji = lirun * CB / 100;
                shhiji += CB*1
                $(this).parent().parent().children().eq(8).children().val(shhiji.toFixed(4))
            })
            $(document).on("keyup", ".SHUb", function (e) {
                var jage = $(e.target).val()*1
                var cb = $(e.target).parent().parent().children().eq(5).text()*1
                var lirun = jage / cb
                var lirnw2 = (lirun - 1) * 100
                $(e.target).parent().parent().children().eq(7).children().val(lirnw2.toFixed(2))
            })
            $(document).on("click", "#tijiao", function (e) {
               
                var now = new Date($.now());
                //获取当前年月日
                var year = (now.getFullYear()).toString();
                var month = (now.getMonth() + 1).toString();
                var date = (now.getDate()).toString();
                var Qs = year + "/" + month + "/" + date
                var FJIDNS = {
                    "FFirst": "客户经理",//一级审批人
                    "FFZ": "审批中",//状态
                    "FFS": $("#dateC").val(),
                    "FTwo": "",//二级审批人
                    "FTZ": "",//状态
                    "FFIZ": "",
                    "FBzt": "",//备注
                    "FJINF": $("#shenDan").text(),
                    "FShenR": $("#Login_N").text(),
                    "FSHENP": "1",
                    "FMIao": "对外报价",
                    "FQsj": Qs
                }
                console.log(FJIDNS);
                if (FJIDNS.FFirst != "" || FJIDNS.FTwo != "" || FJIDNS.FThree != "") {
                    $.ajax({
                        url: "/Procure/HeaApplication",
                        type: 'POST',
                        data: FJIDNS,
                        success: function (text) {
                            console.log(text)
                            window.location.href = "/Custom/General";
                        },
                        error: function (text) {
                            alert("系统错误" + text);
                        }
                    })
                } else {
                    alert("shijnfoodod")
                }
            })
            $(document).on("click", "#Tijiaos", function (e) {
                var BOMinise = []
                $(".SHUa").each(function (i, item) {
                    var idbom = $(item).parent().parent().children().eq(1).text()//id
                    var jiagebom = $(item).parent().parent().children().eq(8).children().first().val()//jiage
                    var LIRUNDHHD = $(item).parent().parent().children().eq(7).children().val()//利润
                    BOMinise.push({
                        BOM2_id: idbom,
                        Inf_huiP: jiagebom,
                        Inf_gong: LIRUNDHHD,
                        Inf_JT: $(item).parent().parent().children().eq(4).text(), // Inf_JT
                    })
                })
                $.ajax({
                    url: "/Custom/AddAppli",
                    type: "POST",
                    data: JSON.stringify(BOMinise),
                    contentType: "application/json;charset=utf-8",
                    dataType: "json",
                    success: function (text) {
                        alert(text)
                        $("#baijai").hide()
                    },
                    error: function (text) {
                        alert("系统错误" + text);
                    }
                })
            })

            $(document).on("keyup", "#PLshu", function () {
                var shu = $(this).val()
                $("input:checkbox[class=Dinaji]:checked").each(function () {
                    var CB = $(this).parent().parent().children().eq(5).text()
                    var shhiji = CB * (shu/100+1)
                    $(this).parent().parent().children().eq(8).children().val(shhiji.toFixed(4))
                    $(this).parent().parent().children().eq(7).children().val(shu)
                })
            })
        })
        //上传备注的方法
        $(document).on("click", "#RZ_tjrz", function () {
            var now = new Date($.now());
            var year = (now.getFullYear()).toString();
            var month = (now.getMonth() + 1).toString();
            var date = (now.getDate()).toString();
            var hours = (now.getHours()).toString()
            var minutes = (now.getMinutes()).toString()
            var name = $("#Login_N").text()
            //组合当前日期
            var sqrq = year + "/" + month + "/" + date + " " + hours + ":" + minutes
            var rzxx = {
                B_Bian: $("#shenDan").text(),
                B_BR: name,
                B_Date: sqrq,
                B_bei: $('#RZ_xznr').val(),

            };
            console.log(rzxx)
            $.ajax({
                url: "/Contracts/AddLogs",
                type: "POST",
                data: rzxx,
                success: function (data) {
                    $('#RZ_xznr').val("")
                    gettbz()
                },
                error: function (data) {
                    alert("erroer");
                },
            })
            //获取备注信息
            function gettbz() {
                var kan = $("#shenDan").val();
                $.ajax({
                    url: "/Application/Application",
                    type: "POST",
                    data: { "App_ban": kan, "state": 4 },
                    success: function (sjik) {
                        $("#RZ_gwzr div").remove();
                        $.each(sjik, function (i, item) {
                            var $tr = $(`
                                     <div>
                                         <div>
                                             <span>${item.B_BR}</span><span>${item.B_Date}</span>
                                         </div>
                                         <div>
                                             ${item.B_bei}
                                         </div>
                                     </div>`);
                            $("#RZ_gwzr").append($tr);
                        })
                    },
                    error: function () {
                        alert("erroer");
                    },
                })
            }


        })
        //显示
        $(function () {
            var ban = $("#shenDan").text()
            $.ajax({
                url: "/Custom/Profit",
                type: "POST",
                data: { "names": ban, "state": 3 },
                success: function (sjik) {
                    console.log(sjik)
                    $(".CNSHU tr").remove();
                    $.each(sjik, function (i, item) {
                        var $tr =
                            $(`<tr style="text-align-last:center;">
                                    <td style="width:50px;"><input type="checkbox" class="Dinaji" /></td>
                                    <td style="display:none">${item.BOM2_id}</td>
                                    <td id="wuliao">${item.BOM2_wuLiu}</td>
                                    <td style="width:37%">${item.BOM2_Gong}</td>
                                    <td>${item.BOM2_Jin}</td>
                                    <td>${item.BOM2_CB}</td>
                                    <td>${item.BOM2_ST}</td>
                                    <td><input type="number" class="SHUa" value="0" style="width:70px"/>%</td>
                                    <td><input type="number" class="SHUb" value="0" style="width:70px"/></td>
                                </tr>`);
                        $(".CNSHU").append($tr);
                    })
                },
                error: function () {
                    alert("erroer");
                },
            })
        })
    </script>
}
